package initalize

import (
	_ "RoccBlog/docs"
	"RoccBlog/global"
	"RoccBlog/middle"
	"github.com/gin-gonic/gin"
	"github.com/swaggo/files"       // swagger embed files
	"github.com/swaggo/gin-swagger" // gin-swagger middleware
)

// InitRouter 初始化路由
func InitRouter() (*gin.Engine, *gin.RouterGroup) {
	engine := gin.Default()
	engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	engine.Use(
		// 验证身份
		middle.Authority(),
		// 验证权限
		middle.CaSbin())
	return engine, engine.Group(global.Config.Server.Prefix)
}
